<?php
/**
* 模块核心类
*
*/

// if(!defined('IN_SERVER'))
// {
// 	//exit('invalid request');
// }

//http://www.my347.com/pt_api/index.php?method=login.login&account=&pwd=&user_token=9a6f17da270a0e6a5affb606ebed0579
//&user_sign=&ver=1.0&op_net=-1&device=-1

class MasterObject
{
	var $Data =array();
	var $Event =array();
	var $Config =array();
	
	var $Get,$Post,$Files,$Request,$Cookie,$Session;
	var $DatabaseHandler;
	var $MemberHandler;
	var $Module ='index';
	
	var $playerAccount='';
	var $playerPassword ='';
	var $playerToken ='';
	var $userSign ='';
	var $version ='';
	var $op_net ='';
	var $device ='';
	var $TimeTamp ='';
	
	var $All_company = array();
	var $Channels = array();
	var $Channel_enable;

	function MasterObject(&$data)
	{
		global $hookall_temp;

		$this->Config = $data['config'];
		$this->Get     = &$_GET;
		$this->Post    = &$_POST;
		$this->Cookie  = &$_COOKIE;
		$this->Session = &$_SESSION;
		$this->Request = &$_REQUEST;
		$this->Server  = &$_SERVER;
		$this->Files   = &$_FILES;
		
		$this->playerAccount =get_param('user_account');
		$this->playerPassword =get_param('user_password');
		$this->playerToken =get_param('user_token');
		
		$this->userSign =get_param('user_sign');
		$this->version =get_param('ver');
		$this->op_net =get_param('op_net');
		$this->device =get_param('device');
		$this->TimeTamp =get_param('timestamp');
	}
	
	function CheckMember()
	{
		// 数据库初始化
		include_once ROOT_PATH . 's_include/db/database.db.php';
		include_once ROOT_PATH . 's_include/db/mysql.db.php';
		$this->DatabaseHandler = new MySqlHandler($this->Config['db_host'],$this->Config['db_port']);
		$this->DatabaseHandler->Charset($this->Config['charset']);
		$this->DatabaseHandler->doConnect($this->Config['db_user'], $this->Config['db_pass'], $this->Config['db_name'], $this->Config['db_persist']);
		Obj::register('DatabaseHandler', $this->DatabaseHandler);
		
		// 玩家信息检测
		include_once ROOT_PATH . 's_include/member.han.php';
		$this->MemberHandler = new MemberHandler();
		$MemberFields = $this->MemberHandler->FetchMember($this->playerAccount, $this->playerToken);
		if(!empty($MemberFields))
		{
			Obj::register("MemberHandler", $this->MemberHandler);
		}
		
		return $MemberFields;
	}
	
	function GameData()
	{
		return $this->Data;
	}
	
	function GameEvent()
	{
		return $this->Event;
	}
}

?>

